package jk.fox.engine.context;

import jk.fox.annotaion.RpcReference;
import jk.fox.annotaion.RpcService;
import jk.fox.common.payload.container.RpcContainer;
import jk.fox.engine.RpcNodeDefinition;

/**
 * @author cuichao
 * @Description: AbstractAnnotationResolverContext
 * @Date: create in 2020/6/2 10:43
 */
public abstract class AbstractAnnotationResolverContext extends AbstractInvocationRpcContext  {

    protected RpcAnnotationResolver resolver;

    public AbstractAnnotationResolverContext(RpcContainer container) {
        super(container);
        resolver = new RpcAnnotationResolver();
    }


   /* protected void resolveRpcAnnotation(RpcNodeDefinition rdf){
        Annotation rpc = cls.getAnnotation(RpcService.class);
        if(rpc != null){
            rdf.setProvider(true);
            resolveServiceAnnotation((RpcService) rpc,rdf);
            return;
        }
        Annotation reference = cls.getAnnotation(RpcReference.class);
        if(reference != null){
            rdf.setProvider(false);
            resolveReferenceAnnotation((RpcReference) reference,rdf);
        }

        resolver.resolveServiceAnnotation(rpcService,rdf);
    }
    */

    /**
     * @param rpcService
     * @param rdf
     */
    protected void resolveServiceAnnotation(RpcService rpcService, RpcNodeDefinition rdf){
        resolver.resolveServiceAnnotation(rpcService,rdf);
    }

    /**
     * @param rpcReference
     * @param rdf
     */
    protected void resolveReferenceAnnotation(RpcReference rpcReference, RpcNodeDefinition rdf){
        resolver.resolveReferenceAnnotation(rpcReference,rdf);
    }

}
